<?php
	include_once 'AdController.php';
	include_once 'Ad.php';
	include_once 'RequestMethod.php';
	//
	function init()
	{
		$c = new AdController();
		$m = $_POST['requestMethod'];
		switch($_POST['requestType'])
		{
			case Ad::DETAILS:
				switch($m)
				{
					case RequestMethod::CREATE:
						$c->createDetails($ad);
					break;
					case RequestMethod::READ:
						$c->readDetails($ad);
					break;
					case RequestMethod::UPDATE:
						$c->updateDetails($ad);
					break;
					case RequestMethod::DELETE:
						$c->deleteDetails($ad);
					break;
				}
			break;
			case Ad::URLS:
				switch($m)
				{
					case RequestMethod::CREATE:
						$c->createUrls($ad);
					break;
					case RequestMethod::READ:
						$c->readUrls($ad);
					break;
					case RequestMethod::UPDATE:
						$c->updateUrls($ad);
					break;
					case RequestMethod::DELETE:
						$c->deleteUrls($ad);
					break;
				}
			break;
			case Ad::BILLINGS:
				switch($m)
				{
					case RequestMethod::CREATE:
						$c->createBillings($ad);
					break;
					case RequestMethod::READ:
						$c->readBillings($ad);
					break;
					case RequestMethod::UPDATE:
						$c->updateBillings($ad);
					break;
					case RequestMethod::DELETE:
						$c->deleteBillings($ad);
					break;
				}
			break;
		}
	}
	init();
?>